import React, {Component} from 'react';
import {Link, NavLink, Router} from 'react-router-dom'

class Nav extends Component {
    constructor(props) {
        super(props)
        this.state = {
            navs: [
                {
                    id: 1,
                    pathname: '/',
                    name: '首页',
                },
                {
                    id: 2,
                    pathname: '/product',
                    name: 'PLP',
                }
            ]
        }
    }
    render() {
        const navList = this.state.navs.map((nav) => {
            return (
                <li key={nav.id}>
                    {/*{nav.name}*/}
                    <Link to={nav.pathname}>{nav.name}</Link>
                </li>
            )
        })
        return (
            <div className="Nav">
                    <Router>
                        <ul>
                            {navList}
                        </ul>
                    </Router>
            </div>
        );
    }
}

export default Nav;
